package com.zhongge.book;

/**
 * @ClassName BorrowInfo
 * @Description TODO 借阅信息类 （将用户id和书本id存储为一组借阅信息）
 * @Author zhongge
 * @Version 1.0
 */
@SuppressWarnings("all")
public class BorrowInfo {
    // 1,1
    private int userId;//用户id
    private int bookId;//图书id

    public BorrowInfo(int userId, int bookId) {
        this.userId = userId;
        this.bookId = bookId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getBookId() {
        return bookId;
    }

    public void setBookId(int bookId) {
        this.bookId = bookId;
    }

    @Override
    public String toString() {
        return "BorrowInfo{" +
                "userId=" + userId +
                ", bookId=" + bookId +
                '}';
    }

    /**
     * 减对象序列化为数组
     * @return 字符串
     */
    public String toJson() {
        StringBuilder sb = new StringBuilder();
        sb.append(userId).append(",");
        sb.append(bookId);
        return sb.toString();
    }
}
